EMT Practice Test

1. Question Content...


Question List

Question1: Which of the following statements about anonymous functions in PHP are NOT true? (Choose two.)

Question2: What function can reverse the order of values in an array so that keys are preserved?

Question3: SIMULATION
What is the output of the following code?

Question4: What can prevent PHP from being able to open a file on the hard drive? (Choose two.)

Question5: Which of the following are NOT acceptable ways to create a secure password hash in PHP? (Choose two.)

Question6: SIMULATION
Which PHP function sets a cookie and URL encodes its value when sending it to the browser?

Question7: One common security risk is exposing error messages directly in the browser. Which PHP configuration directive can be disabled to prevent this?

Question8: SIMULATION
Which value will be assigned to the key 0 in the following code?

Question9: When would you use classes and when would you use namespaces?

Question10: Which of the following functions are used to escape data within the context of HTML? (Choose two.)

Question11: SIMULATION
What is the output of the following code?

Question12: How should class MyObject be defined for the following code to work properly? Assume $array is an array and MyObject is a user-defined class.

Question13: Consider the following two files. When you run test.php, what would the output look like?

Question14: What is the output of the following code?

Question15: What Content-Type HTTP header value is required when sending an HTTP POST request using JavaScript to ensure that PHP can access the data?

Question16: Which of the following expressions will evaluate to a random value from an array below?
$array = ["Sue","Mary","John","Anna"];

Question17: Which of these error types may be handled by a user defined error handler function? (Choose two.)

Question18: You work for a shared hosting provider, and your supervisor asks you do disable user scripts to dynamically load PHP extensions using the d1()function. How can you do this? (Choose two.)

Question19: What is the output of the following code?

Question20: What is the output of the following code?

Question21: Which of the following are valid code snippets? (Choose three.)

Question22: An HTML form contains this form element:

When this form is submitted, the following PHP code gets executed:

Which of the following actions must be taken before this code may go into production? (Choose two.)

Question23: Given a php.ini setting of
default_charset = utf-8
what will the following code print in the browser?

Question24: Assuming UTF-8 encoding, what is the value of $count?

Question25: Which of the following statements about Reflection are correct?

Question26: SIMULATION
What is the output of the following code?

Question27: Consider the following table data and PHP code. What is the outcome?
Table data (table name "users" with primary key "id"):

PHP code (assume the PDO connection is correctly established):

Question28: SIMULATION
What is the output of the following code?

Question29: What function can be used to retrieve an array of current options for a stream context?

Question30: Which class of HTTP status codes is used for server error conditions?

Question31: What is the benefit of using persistent database connections in PHP? (Choose two.)

Question32: An HTML form has two submit buttons. After submitting the form, how can you determine with PHP which button was clicked?

Question33: What is the length of a string returned by: md5(rand(). TRUE);

Question34: Consider the following table data and PHP code. What is the outcome?
Table data (table name "users" with primary key "id"):

PHP code (assume the PDO connection is correctly established):

Question35: You want to parse a URL into its single parts. Which function do you choose?

Question36: What is the output of the following code?

Question37: An unbuffered database query will (choose two):

Question38: Given the following array:

Which function will remove the value 28 from $a?

Question39: What is the output of the following code?

Question40: Which options do you have in PHP to set the expiry date of a session?

Question41: What exception type will catch the error raised by the expression 2 / 0?

Question42: What function allows resizing of PHP's file write buffer?

Question43: Which of the following can NOT be used to send a cookie from within a PHP application?

Question44: Which of the following techniques ensures that a value submitted in a form can only be yesor no?

Question45: What function is best suited for extracting data from a formatted string into an array?

Question46: Which of the following items in the $_SERVER superglobal are important for authenticating the client when using HTTP Basic authentication? (Choose two.)

Question47: Under what condition may HTTP headers be set from PHP if there is content echoed prior to the header function being used?

Question48: What is the output of the following code?

Question49: What is the output of the following code?

Question50: SIMULATION
Your supervisor wants you to disallow PHP scripts to open remote HTTP and FTP resources using PHP's file functions. Which php.ini setting should you change accordingly?

Question51: Which of the following statements about SOAP are NOT true?

Question52: SIMULATION
Which PHP function is used to validate where the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP, and also save the contents into another folder?

Question53: Which of the following will set a 10 seconds read timeout for a stream?

Question54: You'd like to use the class MyDBConnection that's defined in the MyGreatFramework
\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize *as much as possible* the length of the class name you have to type. What would you do?

Question55: Which methods can be used to overload object properties? (Choose two.)

Question56: SIMULATION
Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP?

Question57: Which of the following is NOT true about PHP traits? (Choose two.)

Question58: In a shared hosting environment, session data can be read by PHP scripts written by any user. How can you prevent this? (Choose two.)

Question59: What is the output of the following code?

Question60: What is the output of the following code?

Question61: What is the output of the following code?

Question62: What is the difference between the spaceship operator (<=>) and the strcmp() function?

Question63: Given a DateTime object that is set to the first second of the year 2017, which of the following samples will correctly return a date in the format '2017-01-01 00:00:01'?

Question64: What is the method used to execute XPath queries in the SimpleXML extension?

Question65: Is the following code vulnerable to SQL Injection where ($mysqliis an instance of the MySQLi class)?

Question66: What is the output of the following code?

Question67: After performing the following operations:

What will be the value of $a?

Question68: What method can be used to find the tag <any> via the DOM extension?

Question69: What is the output of the following code?

Question70: What is the output of the following code?

Question71: What will the following function call print?

Question72: Consider 3 PHP files that are called asynchronously via XmlHttpRequest:

Which of the following statements is true? (Choose two.)

Question73: Which of the following is NOT possible using reflection?

Question74: What is the output of this code?

Question75: What is the output of the following code?